<?php

namespace common\entity;


/**
 * @author ZWJ
 * @date 2024-07-22
 * @description 分页实体
 */
class PagingEntity
{
    /**
     * @var int $page 当前页码,默认1
     */
    private int $page = 1;

    /**
     * @var int $limit 每页取多少条，默认10
     */
    private int $limit = 10;

    /**
     * @return int
     */
    public function getPage(): int
    {
        return $this->page;
    }

    /**
     * @param int $page
     */
    public function setPage(int $page): void
    {
        $this->page = $page;
    }

    /**
     * @return int
     */
    public function getLimit(): int
    {
        return $this->limit;
    }

    /**
     * @param int $limit
     */
    public function setLimit(int $limit): void
    {
        $this->limit = $limit;
    }

    /**
     * 封装一个分页参数
     *
     * @return array
     */
    public function getPaginateCondition(): array
    {
        return ['list_rows' => $this->getLimit(), 'page' => $this->getPage()];
    }
}